package cn.wen.mybatis;

import java.util.List;

public class MyBatisDaoImpl implements IMyBatisDao {

    private MyBatisTemplate myBatisTemplate;

    public final void setMyBatisTemplate(MyBatisTemplate myBatisTemplate) {
        this.myBatisTemplate = myBatisTemplate;
    }
    
    @Override
    public MyBatisTemplate getTemplate() {
        return this.myBatisTemplate;
    }

    @Override
    public Object selectOne(String sqlMap) {
	return getTemplate().selectOne(sqlMap);
    }

    @Override
    public Object selectOne(String sqlMap, Object model) {
	return getTemplate().selectOne(sqlMap, model);
    }

    @Override
    public List<?> selectList(String sqlMap) {
	return getTemplate().selectList(sqlMap);
    }

    @Override
    public List<?> selectList(String sqlMap, Object model) {
	return getTemplate().selectList(sqlMap, model);
    }

    @Override
    public List<?> selectPagination(String sqlMap) {
	return getTemplate().selectPagination(sqlMap);
    }

    @Override
    public List<?> selectPagination(String sqlMap, Object model) {
	return getTemplate().selectPagination(sqlMap, model);
    }

    @Override
    public int delete(String sqlMap) {
	return getTemplate().delete(sqlMap);
    }

    @Override
    public int delete(String sqlMap, Object model) {
	return getTemplate().delete(sqlMap, model);
    }

    @Override
    public int insert(String sqlMap) {
	return getTemplate().insert(sqlMap);
    }

    @Override
    public int insert(String sqlMap, Object model) {
	return getTemplate().insert(sqlMap, model);
    }

    @Override
    public int update(String sqlMap) {
	return getTemplate().update(sqlMap);
    }

    @Override
    public int update(String sqlMap, Object model) {
	return getTemplate().update(sqlMap, model);
    }

    @Override
    public Object execute(DaoCallback callback) {
	try {
	    return callback.execute(getTemplate());
	}
	catch (Exception e) {
	    throw new DaoException(e);
	}
    }

}
